import {
  camelize as _camelize,
  kebabCase as _kebabCase,
  roundNumber as _roundNumber,
  padNumber as _padNumber,
  validatePhoneNumber as _validatePhoneNumber,
  debounce as _debounce,
  isPromiseLike as _isPromiseLike
} from "fan-utils";
const isPromiseLike = _isPromiseLike;
const camelize = _camelize;
const kebabCase = _kebabCase;
const roundNumber = _roundNumber;
const padNumber = _padNumber;
const debounce = _debounce;
const validatePhoneNumber = _validatePhoneNumber;
function createNamespace(name) {
  const prefixedName = `fan-${name}`;
  return [camelize(prefixedName, true)];
}
function createUniqueId(opt) {
  return "" + ((opt == null ? void 0 : opt.prefix) || "") + Math.floor(Math.random() * 1e6).toString(36);
}
function resolveAspectRatio(ar) {
  if (typeof ar === "string") {
    if (ar.includes("/") || ar.includes(":")) {
      const [a, b] = ar.replace("/", ":").split(":");
      return Number(a) / Number(b);
    }
    return Number(ar);
  }
  return ar;
}
function isInnerRoute(url) {
  if (!url || url.startsWith("http") || url.startsWith("alipay"))
    return false;
  return true;
}
const doSleep = (time = 0) => {
  return new Promise((resolve) => {
    setTimeout(() => resolve(true), time);
  });
};
const parseTimeData = (time, hasDays = true) => {
  const SECOND = 1e3;
  const MINUTE = 60 * SECOND;
  const HOUR = 60 * MINUTE;
  const DAY = 24 * HOUR;
  time = time || 0;
  let days = "00";
  let hours = "00";
  if (hasDays) {
    days = padNumber(Math.floor(time / DAY));
    hours = padNumber(Math.floor(time % DAY / HOUR));
  } else {
    hours = padNumber(Math.floor(time / HOUR));
  }
  const minutes = padNumber(Math.floor(time % HOUR / MINUTE));
  const seconds = padNumber(Math.floor(time % MINUTE / SECOND));
  const milliseconds = Math.floor(Math.floor(time % SECOND) / 100);
  return {
    days,
    hours,
    minutes,
    seconds,
    milliseconds
  };
};
export {
  camelize,
  createNamespace,
  createUniqueId,
  debounce,
  doSleep,
  isInnerRoute,
  isPromiseLike,
  kebabCase,
  padNumber,
  parseTimeData,
  resolveAspectRatio,
  roundNumber,
  validatePhoneNumber
};
